package com.zhinong.service.impl;

import com.zhinong.entity.Product;
import com.zhinong.entity.Products;
import com.zhinong.mapper.SearchMapper;
import com.zhinong.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {

    @Autowired
    private SearchMapper searchMapper;

    @Override
    public List<String> getHotTags() {
        return searchMapper.selectHotTags();
    }

    @Override
    public List<String> getSearchHistory(String userId) {
        return searchMapper.selectSearchHistory(userId);
    }

    @Override
    public void addSearchHistory(String userId, String keyword) {
        searchMapper.insertSearchHistory(userId, keyword);
    }

    @Override
    public List<Products> searchProducts(String keyword) {
        return searchMapper.searchProductsByKeyword(keyword);
    }
}